package com.tianji.learning.controller;

import com.tianji.learning.domain.vo.SignResultVO;
import com.tianji.learning.service.SignService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.List;

@RestController
@RequestMapping("/sign-records")
@RequiredArgsConstructor
@Slf4j
public class SignController {
    private final SignService signService;

    @PostMapping
    @ApiOperation("签到")
    public SignResultVO signRecord() throws ParseException {
        return signService.signRecord();
    }

    @GetMapping
    @ApiOperation("查询本月每一天的签到情况")
    public List<Integer> signRecords() {
        return signService.signRecords();
    }
}
